package com.techstar.ats.type;

import java.util.Set;
import java.util.function.IntFunction;

import com.techstar.ats.status.*;

public enum DeviceType implements Enumerated {
	RTU("集中站", RtuStatus.class, RtuStatus.values(), RtuStatus::valueOf),
	STATION("车站", StationStatus.class, StationStatus.values(), StationStatus::valueOf),
	SIGNAL("信号机", SignalStatus.class, SignalStatus.values(), SignalStatus::valueOf),
	SWITCH("道岔", SwitchStatus.class, SwitchStatus.values(), SwitchStatus::valueOf),
	TRACK("轨道", TrackStatus.class, TrackStatus.values(), TrackStatus::valueOf),
	ENTRY("方向", EntryStatus.class, EntryStatus.values(), EntryStatus::valueOf),
	PLATFORM("站台", PlatformStatus.class, PlatformStatus.values(), PlatformStatus::valueOf),
	FAS("火警", FasStatus.class, FasStatus.values(), FasStatus::valueOf),
	SCADA("供电区段", ScadaStatus.class, ScadaStatus.values(), ScadaStatus::valueOf),
	BAS("风机", BasStatus.class, BasStatus.values(), BasStatus::valueOf),
	WATERPROOF_DOOR("防淹门", WaterproofDoorStatus.class, WaterproofDoorStatus.values(), WaterproofDoorStatus::valueOf),
	WORK_AREA("工作区", WorkAreaStatus.class, WorkAreaStatus.values(), WorkAreaStatus::valueOf),
	GAMA("区域自动驾驶", GamaStatus.class, GamaStatus.values(), GamaStatus::valueOf);

	public final Class<?> klass;
	public final StatusEnumerated[] allOf;
	public final IntFunction<Set<? extends Enumerated>> of;
	private final String literal;

	DeviceType(String literal, Class<?> klass, StatusEnumerated[] allOf, IntFunction<Set<? extends Enumerated>> of) {
		this.literal = literal;
		this.klass = klass;
		this.allOf = allOf;
		this.of = of;
	}

	public static DeviceType valueOf(int value) {
		return Enumerated.valueOf(DeviceType.class, value);
	}

	public String literal() {
		return this.literal;
	}
}
